package com.tjc.service.impl;

import com.tjc.dao.AccountDao;
import com.tjc.domain.Account;
import com.tjc.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by hongcaixia on 2020/1/4.
 */
@Service
public class AccountServiceImpl implements AccountService{

    @Autowired
    private AccountDao accountDao;

    @Override
    public boolean findAll(Integer eid,String pwd) {
        System.out.println("service：查找所有");
        List<Account>accountList = accountDao.selectAll();
        for (Account a:accountList
             ) {
            if (a.getEid()==eid){
                if(a.getPwd().equals(pwd)){
                    return true;
                }
            }
        }
        return false;
    }

    @Override
    public void saveAccount(Account account) {
        System.out.println("service：保存账户");
        accountDao.insertAccount(account);
    }
}
